<?php
class WendaController extends DefaultModuleController {


	
	public function actionList(){
		$page = intval(getgpc('page'));
		if (!$page) $page = 1;
		$search = getgpc('search');
		$id = getgpc(2);
		if ($search) {
			$sqladd = "title like '%".$search."%' " ;
		}
		else {
			$sqladd = "categoryId='$id' ";
		}
		$wendaList = $this->ArticleModel->findAll($sqladd, $page, GODHOUSE_PPP3, 'createdTime DESC');
		foreach ($wendaList as &$v){
			$v['createdTime2'] = date("Y-m-d",$v['createdTime']);
		}
		
		
		$num = $this->ArticleModel->count($sqladd);
		$multipage = $this->page($num, GODHOUSE_PPP3, $page, 'wenda-list-'.$id.'.htm');
		
		$this->view->assign('id',$id);
		$this->view->assign('multipage', $multipage);
		$this->view->assign('wendaList',$wendaList);

		$this->display('wenda_list');
	}
}